package com.example.demo.topic;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TopicSender {
    @Autowired
    private RabbitTemplate template;

    public void sendMessage0(String message) {
        //发送message0
        template.convertAndSend(TopicQueueConfig.exchange, TopicQueueConfig.routingKey0, TopicQueueConfig.routingKey0 + "->" + message);
    }
    public void sendMessage1(String message) {
        //发送message1
        template.convertAndSend(TopicQueueConfig.exchange, TopicQueueConfig.routingKey1, TopicQueueConfig.routingKey1 + "->" + message);
    }
}
